/*
  ==============================================================================

    PluginChain.h
    Created: 28 Nov 2024 11:43:12am
    Author:  leis

  ==============================================================================
*/

#pragma once
#include "PluginInfos.h"
#include "TaskManager.h"
class PluginChain
{
public:
	PluginChain(int,int,bool);
	~PluginChain();
	PluginChain(const PluginChain&) = delete;
	PluginChain& operator=(const PluginChain&) = delete;

	PluginChain(PluginChain&&) noexcept = default;
	PluginChain& operator=(PluginChain&&) noexcept = default;
	bool available = true;
	int index = 0;
	void Prepare(Task* task);
	
	void Progress(Task* task, std::unique_ptr<juce::AudioFormatReader> reader);
	void Reset();
	void ProgressRealTime(float* buffer, int bufferSize, int channelNum);
private:
	std::vector<std::unique_ptr<juce::AudioPluginInstance>> plugins;
	int maxChannel = 1;
	int bufferSize = 512;
	void InnerPrepare(Task* task);
};